package com.hsav.kcxb.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

import com.hsav.kcxb.R;
import com.hsav.kcxb.view.ToneAdjuster;
import com.kcbsdk.EventHandler;
import com.kcbsdk.MyTools.ACloudType;
import com.kcbsdk.MyTools.ALocalInfoList;
import com.kcbsdk.MyTools.AUiPageName;

import java.io.File;

import me.wcy.lrcview.LrcView;

import static com.hsav.kcxb.main.MSYS.mMyManage;
import static com.hsav.kcxb.main.MSYS.mMyRankBa;
import static com.hsav.kcxb.main.MSYS.mMyTools;

public class MixActivity extends BaseActivity implements View.OnClickListener {

    private ToneAdjuster toneAdjuster;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mix);
        initView();
    }
    private void initKcbData() {
        mMyManage.setUiEventCallBack(this, new EventHandler() {
            @Override
            public void onComplete(int methodType, boolean isFail, String message) {
                if (methodType > 0) {
                    if (isFail) {
                        mMyManage.Toast(String.format("%s%s(%08x)", getString(R.string.methodError), message, methodType));
                    } else {
                        // 这里放各个以isSucess开始的方法，调用方法返回的处理
                    }
                } else {
                    // 这里放各个以isEvent开始的方法，各种随机事件返回的处理
                }
            }
        });
    }




    private void initView() {
        ImageView imgBack = (ImageView) findViewById(R.id.img_back);
        imgBack.setOnClickListener(this);

        TextView textTitle = (TextView) findViewById(R.id.text_title);
        textTitle.setText("演员");

        LrcView lrcView = (LrcView) findViewById(R.id.lrcView);
        lrcView.loadLrc(new File(getApplication().getCacheDir(), "cbg.lrc"));

        TextView textCurrTime = (TextView) findViewById(R.id.text_curr_time);
        textCurrTime.setText("00:00");

        TextView textTotalTime = (TextView) findViewById(R.id.text_total_time);
        textTotalTime.setText("03:00");

        SeekBar progressBar = (SeekBar) findViewById(R.id.bar_progress);
        progressBar.setProgress(50);

        TextView textUp = (TextView) findViewById(R.id.text_up);
        textUp.setOnClickListener(this);

        TextView textDown = (TextView) findViewById(R.id.text_down);
        textDown.setOnClickListener(this);

        toneAdjuster = (ToneAdjuster) findViewById(R.id.toneAdjuster);
        toneAdjuster.setToneCount(7);
        toneAdjuster.setSelectedTone(4);

        TextView textSave = (TextView) findViewById(R.id.text_save);
        textSave.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId())
        {
            case R.id.img_back:
                finish();
                break;
            case R.id.text_up:
                Toast.makeText(this, "升调按钮被点击", Toast.LENGTH_SHORT).show();
                toneAdjuster.up();
                break;
            case R.id.text_down:
                Toast.makeText(this, "降调按钮被点击", Toast.LENGTH_SHORT).show();
                toneAdjuster.down();
                break;
            case R.id.text_save:
                Toast.makeText(this, "保存按钮被点击", Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
